<template>
    <div>
        <el-row>
            <!-- <el-button type="primary" @click="sendToken">发送Token</el-button>
            <el-button type="primary" @click="startControl">启动场控</el-button>
            <el-button type="primary" @click="sendConfig">传递参数</el-button> -->
            <!-- <el-button type="primary" @click="closeSocket">断开websocket</el-button> -->
            <el-button type="primary" @click="socketInit">连接场控</el-button>
        </el-row>

        <el-card style="margin-top:10px;width: calc(100vw - 20px);">
            <template #header>
                场控组件
            </template>
            <CommentScroll :comments="messageList"></CommentScroll>
        </el-card>
    </div>
</template>

<script setup>
import { onMounted, onUnmounted, ref, watch } from 'vue';
import { ElMessage } from 'element-plus'
import CommentScroll from './CommentScroll.vue'

const webSocket = ref(null)
const messageList = ref([]);
const keywords = [
    { key: "like", content: "点赞" },
    { key: "haha", content: "哈哈" },
    { key: "guanzhu", content: "关注" },
    { key: "lihai", content: "厉害" },
    { key: "6", content: "6" },
];

const roomId = ref("610921891289") // 房间号

const emit = defineEmits(['triggerKeywordsFn', 'updateBarrage'])

watch(() => messageList.value, (newValue, oldValue) => {
    console.log("messageList.value", messageList.value)
    if (newValue.length > 0) {
        emit("updateBarrage", messageList.value)
    }
}, { deep: true })

const socketInit = () => {
    console.log("socketInit", webSocket)
    webSocket.value = new WebSocket('ws://127.0.0.1:12303')
    webSocket.value.onopen = () => {
        console.log('WebSocket 连接成功!');
        sendToken()
    };
    // 监听消息事件
    webSocket.value.onmessage = (event) => {
        const rst = JSON.parse(event.data);
        if (rst.type.indexOf('1000') > -1) {

        } else {
            console.log('Received message333:', rst);
        }

        if (rst.type == '1000') {

        } else if (rst.type === '1001') {
            // 登录成功 启动场控
            startControl()
        } else if (rst.type === '10021') {
            // 场控创建成功，传递配置
            sendConfig()
        } else if (rst.type === '8890') {
            messageList.value.push(rst.msg);
            //  判断是否存在关键词
            const existKeyWords = keywords.find(item => rst.msg.chat_msg.indexOf(item.content) > -1)
            if (existKeyWords) {
                // 存在关键词
                console.log('存在关键词', existKeyWords)
                emit("triggerKeywordsFn", existKeyWords)
            }
        } else if (rst.type === '1041') {
            ElMessage.error(rst.msg)
        }

    };

    // 监听 WebSocket 错误事件
    webSocket.value.onerror = (error) => {
        console.error('WebSocket Error:', error);
    };

    // 监听 WebSocket 连接关闭事件
    webSocket.value.onclose = () => {
        console.log('WebSocket connection closed');
    };
}

const closeSocket = () => {
    if (webSocket.value) {
        webSocket.value.close()
    }
}

const sendToken = () => {
    const token = localStorage.getItem('token')
    const messageData = JSON.stringify({
        key: 'token',
        value: token
    })
    // console.log("sendToken-----", messageData)
    // console.log("webSocket-----", webSocket.value)
    webSocket.value.send(messageData)
}

const startControl = () => {
    const messageData = JSON.stringify({
        key: 'start',
        value: roomId.value
    })
    webSocket.value.send(messageData)
}

const sendConfig = () => {
    const messageData = JSON.stringify(
        {
            "key": "config",
            // value: "{\"overallSituationConfig\":{\"id\":\"08185df6-477b-4249-b09a-4cd49a1b13c0\",\"platform\":\"快手\",\"liveRoomNo\":\"XiaoLe12-30\",\"liveId\":\"5ef574f0-5df6-4f3f-8461-1574e8853237\",\"operationMode\":0,\"operationTime\":10,\"RegularInteractionPriority\":3,\"OrdinaryUserPriority\":2,\"GiftThankPriority\":1,\"QandAPriority\":4,\"AiChatPriority\":0,\"globalnaturalLanguageSwitch\":0,\"globalanchorNick\":\"测试\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2025-01-17T10:52:14.4043769\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\",\"speechtype\":0},\"qandAConfig\":{\"id\":\"3ced6314-7033-4014-b8c8-bc916fa7acd0\",\"enable\":0,\"appointWithinDoNotReply\":60,\"liveId\":\"5ef574f0-5df6-4f3f-8461-1574e8853237\",\"replyWay\":2,\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.3420461\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.2900807\"},\"qandAs\":[{\"id\":\"25469742-ba2b-43e8-9385-b0d9a85871b8\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"链接\",\"likeProblems\":\"[{\\\"content\\\":\\\"1号\\\"},{\\\"content\\\":\\\"2号\\\"},{\\\"content\\\":\\\"3号\\\"},{\\\"content\\\":\\\"链接\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"1号和2号的区别就是鱼获斤数不一样，现在直播福利，1号和2号可同时叠3张，相当于45斤以内鱼获自由了，这是以前从没有的活动力度，抓紧去拍\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.5454464\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.2970572\"},{\"id\":\"10521acd-2c9a-432c-8e04-41e50e19f5bc\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"地址\",\"likeProblems\":\"[{\\\"content\\\":\\\"导航\\\"},{\\\"content\\\":\\\"哪里\\\"},{\\\"content\\\":\\\"地址\\\"},{\\\"content\\\":\\\"地方\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"这里是镇江丹阳香海琴枫浪漫庄园景区里面的垂钓中心哦~，就在312国道边上，非常方便，您直接导航就可以啦\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.5324119\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3090177\"},{\"id\":\"edb3c161-2640-48c3-b390-56428c2b7959\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"价格\",\"likeProblems\":\"[{\\\"content\\\":\\\"收费\\\"},{\\\"content\\\":\\\"怎么卖\\\"},{\\\"content\\\":\\\"多少钱\\\"},{\\\"content\\\":\\\"怎么钓\\\"},{\\\"content\\\":\\\"票含什么\\\"},{\\\"content\\\":\\\"券含什么\\\"},{\\\"content\\\":\\\"路亚收费\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"右下角所有垂钓票一车一券制，车内人随车入园即可！钓友不限时不限竿不限杆长不限饵料不限位置，现在直播福利价~1号2号可各叠使用3张，30天内都有效，过期自动退\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.5204293\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3130038\"},{\"id\":\"52459960-c547-43bb-b694-5eee233c6fab\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"券\",\"likeProblems\":\"[{\\\"content\\\":\\\"怎么用\\\"},{\\\"content\\\":\\\"用几张\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"现在活动期间，1号2号可以各叠加使用3张，相当于一个人可以45斤内鱼获自由，这个活动以前都是没有的，只有这几天才有呢\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.5074142\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3159938\"},{\"id\":\"5f22bdc0-c924-472d-83a8-c02044aaae46\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"超出鱼获\",\"likeProblems\":\"[{\\\"content\\\":\\\"多少一斤\\\"},{\\\"content\\\":\\\"多出\\\"},{\\\"content\\\":\\\"超出\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"现在直播间下单右下角垂钓券，不仅是离开直播间没有的优惠价，1号和2号还可以各叠加使用3张哦，以前都没有这个活动的\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.4945125\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3199803\"},{\"id\":\"f32721c7-86cf-4682-a98a-287e62c8bdb8\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"鱼种\",\"likeProblems\":\"[{\\\"content\\\":\\\"什么鱼\\\"},{\\\"content\\\":\\\"哪些鱼\\\"},{\\\"content\\\":\\\"啥鱼\\\"},{\\\"content\\\":\\\"路亚鱼种\\\"},{\\\"content\\\":\\\"混塘\\\"},{\\\"content\\\":\\\"有鱼\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"这里是水库改建的，鱼品不输野生鱼，近期出鱼率较高的有翘嘴银鳕鱼白鲥鱼青鱼鲫鱼鲢鳙鳊鱼、鮰鱼，里面还有甲鱼鳜鱼草鱼等\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.4821883\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.323967\"},{\"id\":\"905e259d-637b-4641-8dbb-82d17fc3a006\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"营业时间\",\"likeProblems\":\"[{\\\"content\\\":\\\"开门\\\"},{\\\"content\\\":\\\"关门\\\"},{\\\"content\\\":\\\"钓多久\\\"},{\\\"content\\\":\\\"什么时候可以钓\\\"},{\\\"content\\\":\\\"几点可以钓\\\"},{\\\"content\\\":\\\"预约\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"我们早上8点开园，下午5点闭园，无需预约，节假日人比较多，您可以早一些来，早到早选择，选一个喜欢的垂钓位置哈\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.4691714\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3279536\"},{\"id\":\"38c63661-a6ad-4be0-a80c-b5d4519441c2\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"吃饭\",\"likeProblems\":\"[{\\\"content\\\":\\\"吃饭\\\"},{\\\"content\\\":\\\"饭吃\\\"},{\\\"content\\\":\\\"用餐\\\"},{\\\"content\\\":\\\"午饭\\\"},{\\\"content\\\":\\\"晚饭\\\"},{\\\"content\\\":\\\"吃的解决\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"如果您一位，可以联系钓台的编号卡点餐，简餐两荤两素一汤，如果人数比较多，可以提前咨询客服，预约农家乐或露营烧烤烤肉寿喜锅\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.4563277\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3319404\"},{\"id\":\"e15b1848-35f8-4979-9ad6-38650878dbb0\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"停车\",\"likeProblems\":\"[{\\\"content\\\":\\\"哪里停\\\"},{\\\"content\\\":\\\"停车\\\"},{\\\"content\\\":\\\"停哪里\\\"},{\\\"content\\\":\\\"离鱼塘远不远\\\"},{\\\"content\\\":\\\"离鱼塘多远\\\"},{\\\"content\\\":\\\"鱼塘多久\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"购买右下角的垂钓票后，在景区外停车场入口，核销验券，直接开到垂钓中心边上的停车场，非常方便，停车是免费的\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.4441507\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.335927\"},{\"id\":\"0e89520f-6717-4019-889a-34959716a04c\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"游乐设施\",\"likeProblems\":\"[{\\\"content\\\":\\\"有什么玩的\\\"},{\\\"content\\\":\\\"小朋友玩的\\\"},{\\\"content\\\":\\\"玩的收费\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"香海琴枫主打的就是亲子主题，购买垂钓票后，其中有差不多十项都是可以免费玩的，本店还有付费项目的套票畅游更划算哦\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.4311342\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3399137\"},{\"id\":\"43a599b6-ee1f-4b1a-9f88-6bb02f97c521\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"买票\",\"likeProblems\":\"[{\\\"content\\\":\\\"不钓鱼买票\\\"},{\\\"content\\\":\\\"带家人收费\\\"},{\\\"content\\\":\\\"带朋友收费\\\"},{\\\"content\\\":\\\"带家人买票\\\"},{\\\"content\\\":\\\"带朋友买票\\\"},{\\\"content\\\":\\\"带家人买券\\\"},{\\\"content\\\":\\\"带朋友买券\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"亲，我们是一车一券制，右下角的垂钓票，一车人的景区门票都含进去了，不需要再购买门票，随车进园就可以\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.4181531\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3439005\"},{\"id\":\"f394b744-d63f-42d0-9430-e5a234fece43\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"空军\",\"likeProblems\":\"[{\\\"content\\\":\\\"钓不到\\\"},{\\\"content\\\":\\\"空军\\\"},{\\\"content\\\":\\\"没钓到\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"这里是斤塘您真不用担心钓不到，但我们还是会给鱼获不足的宝子庄园自营的走地鸡、桑叶茶等好几样高品质的农产品选择补足哦\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.405181\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3468904\"},{\"id\":\"a0ccb3d9-670b-4b2e-954b-7239e58eb725\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"回鱼\",\"likeProblems\":\"[{\\\"content\\\":\\\"回鱼\\\"},{\\\"content\\\":\\\"钓到的不想要\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"亲，我们对品质要求比较高，暂不支持回鱼， 现在直播间下单右下角垂钓票，可叠加使用，45斤之内畅钓，以前都没有这个活动\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.3921653\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3508769\"},{\"id\":\"897f786b-9e5e-4338-9003-16ae8b5976d4\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"限制\",\"likeProblems\":\"[{\\\"content\\\":\\\"限杆\\\"},{\\\"content\\\":\\\"钓多久\\\"},{\\\"content\\\":\\\"路亚\\\"},{\\\"content\\\":\\\"时间\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"亲，右下角的垂钓票，不限时不限竿不限杆长不限饵料，独立豪华配套钓台随您选，现在下单直播间更优惠30天内都有效，过期自动退\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.3759999\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3548637\"},{\"id\":\"2a8ba761-98b8-4d00-aa02-75c035428653\",\"productId\":\"bbf94016-01f6-4fcb-aba0-a167a4857f2e\",\"enable\":1,\"problem\":\"夜钓\",\"likeProblems\":\"[{\\\"content\\\":\\\"夜钓\\\"},{\\\"content\\\":\\\"晚上\\\"},{\\\"content\\\":\\\"黑坑\\\"},{\\\"content\\\":\\\"天塘\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"应大哥的呼吁，正在筹备夜钓，天塘、黑坑、练杆塘，点个关注，一旦开放，第一时间视频同步，近期练杆塘马上要跟大家见面啦~\\\"}]\",\"state\":null,\"creator\":\"1866333545327837185\",\"createDate\":\"2024-12-26T10:07:58.3550293\",\"updater\":\"1866333545327837185\",\"updateDate\":\"2025-01-16T08:23:13.3588504\"}],\"welcomeConfig\":{\"id\":\"0f3f5f77-ec4c-48b8-9083-1cf497c81d47\",\"liveId\":\"5ef574f0-5df6-4f3f-8461-1574e8853237\",\"enable\":0,\"platform\":\"快手\",\"replyWay\":2,\"userLevel\":0,\"welcomeFans\":0,\"fansLevel\":0,\"fansName\":\"\",\"ordinaryUserLevel\":10,\"ordinaryUserReplys\":\"\",\"seniorUserReplys\":\"\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2025-01-17T10:52:11.9073806\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"giftThankConfig\":{\"id\":\"3bfaa42e-9c01-4ba3-b873-6efb86e6d8c9\",\"platform\":\"快手\",\"enable\":0,\"liveId\":\"5ef574f0-5df6-4f3f-8461-1574e8853237\",\"replyWay\":2,\"thankRule\":1,\"giftMoney\":10,\"smallAmountMoney\":100,\"smallAmountThankContents\":null,\"bigAmountThankContents\":null,\"strengthenThankEnable\":null,\"strengthenThankContents\":null,\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2025-01-17T10:52:14.4258775\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"regularInteractionConfig\":null,\"aiChatConfig\":{\"id\":null,\"liveId\":null,\"platform\":null,\"enable\":0,\"replyWay\":0,\"keywords\":null,\"state\":null,\"creator\":null,\"createDate\":\"0001-01-01T00:00:00\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"interestNumberConfig\":{\"id\":null,\"liveId\":\"XiaoLe12-30\",\"platform\":\"快手\",\"enable\":0,\"replyWay\":1,\"interestNumberParameters\":null,\"state\":null,\"creator\":null,\"createDate\":\"0001-01-01T00:00:00\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"likeConfig\":{\"id\":null,\"liveId\":\"XiaoLe12-30\",\"platform\":\"快手\",\"enable\":0,\"replyWay\":1,\"likeParameters\":null,\"state\":null,\"creator\":null,\"createDate\":\"0001-01-01T00:00:00\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"onLineNumberConfig\":{\"id\":null,\"liveId\":\"XiaoLe12-30\",\"platform\":\"快手\",\"enable\":0,\"replyWay\":1,\"onLineNumberParameters\":null,\"state\":null,\"creator\":null,\"createDate\":\"0001-01-01T00:00:00\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"blacklistConfig\":{\"id\":null,\"liveId\":\"XiaoLe12-30\",\"platform\":\"快手\",\"blacklist\":null,\"state\":null,\"creator\":null,\"createDate\":\"0001-01-01T00:00:00\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"}}",
            "value": "{\"overallSituationConfig\":{\"id\":\"736e8ce3-f79a-41b4-a861-0b82bf659445\",\"platform\":\"抖音\",\"liveRoomNo\":\"909682638981\",\"liveId\":\"e78fc1a2-8a5b-4104-b478-5229bce3071b\",\"operationMode\":0,\"operationTime\":1,\"RegularInteractionPriority\":3,\"OrdinaryUserPriority\":2,\"GiftThankPriority\":1,\"QandAPriority\":4,\"AiChatPriority\":0,\"globalnaturalLanguageSwitch\":0,\"globalanchorNick\":\"测试间\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2024-12-17T20:00:32.2232843\",\"updater\":\"1787691028850118657\",\"updateDate\":\"2025-01-15T09:58:34.3959704\",\"Speechtype\":0},\"qandAConfig\":{\"id\":\"422c0e29-181d-47db-a5d1-1f2e971b364e\",\"enable\":1,\"appointWithinDoNotReply\":1,\"liveId\":\"e78fc1a2-8a5b-4104-b478-5229bce3071b\",\"replyWay\":2,\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2024-12-17T20:00:32.2592843\",\"updater\":\"1787691028850118657\",\"updateDate\":\"2025-01-15T09:58:25.6327032\"},\"qandAs\":[{\"id\":\"93560061-41e1-40b4-8407-a64ca56491e0\",\"productId\":\"82796d91-4cc4-4c5d-b9ad-d45137d27647\",\"enable\":1,\"problem\":\"快递\",\"likeProblems\":\"[{\\\"content\\\":\\\"快递\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"快递一般两到三天可以到\\\"}]\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2024-12-26T15:56:13.631866\",\"updater\":\"1787691028850118657\",\"updateDate\":\"2025-01-15T09:58:25.6417029\"},{\"id\":\"508a99b1-4c81-47b7-aef4-5ce8d5cd9f7a\",\"productId\":\"82796d91-4cc4-4c5d-b9ad-d45137d27647\",\"enable\":1,\"problem\":\"优惠\",\"likeProblems\":\"[{\\\"content\\\":\\\"有优惠吗\\\"},{\\\"content\\\":\\\"优惠\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"七天无理由退货，送货到家，价格地板价\\\"},{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"七天无理由退货，送货到家，价格地板价\\\"}]\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2024-12-26T15:41:31.2780964\",\"updater\":\"1787691028850118657\",\"updateDate\":\"2025-01-15T09:58:25.6597033\"},{\"id\":\"6745a76d-b57f-4acc-94bd-ebbd8c29dd1f\",\"productId\":\"82796d91-4cc4-4c5d-b9ad-d45137d27647\",\"enable\":1,\"problem\":\"包邮吗\",\"likeProblems\":\"[{\\\"content\\\":\\\"包邮吗\\\"},{\\\"content\\\":\\\"包邮费吗\\\"},{\\\"content\\\":\\\"邮费多少\\\"}]\",\"replys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"包邮的，江浙沪都包邮\\\"},{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"包邮的，江浙沪都包邮\\\"},{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"包邮的，江浙沪都包邮\\\"}]\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2024-12-26T15:30:11.6009423\",\"updater\":\"1787691028850118657\",\"updateDate\":\"2025-01-15T09:58:25.6667029\"}],\"welcomeConfig\":{\"id\":\"7c73e671-bad9-44d7-9dde-12dfe9763c0d\",\"liveId\":\"e78fc1a2-8a5b-4104-b478-5229bce3071b\",\"enable\":0,\"platform\":\"抖音\",\"replyWay\":1,\"userLevel\":0,\"welcomeFans\":0,\"fansLevel\":0,\"fansName\":\"\",\"ordinaryUserLevel\":10,\"ordinaryUserReplys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"13234{主播名称}{观众名称}\\\"}]\",\"seniorUserReplys\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"长河落日圆{观众名称}欢迎你\\\"}]\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2024-12-17T20:00:32.203285\",\"updater\":\"1787691028850118657\",\"updateDate\":\"2025-01-09T14:05:22.9867716\"},\"giftThankConfig\":{\"id\":\"671187bd-9c45-4fce-b153-fa37a46d1739\",\"platform\":\"抖音\",\"enable\":0,\"liveId\":\"e78fc1a2-8a5b-4104-b478-5229bce3071b\",\"replyWay\":2,\"thankRule\":1,\"giftMoney\":10,\"smallAmountMoney\":100,\"smallAmountThankContents\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"1234{主播名称}{礼物名称}\\\"}]\",\"bigAmountThankContents\":null,\"strengthenThankEnable\":null,\"strengthenThankContents\":null,\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2024-12-17T20:00:32.2502843\",\"updater\":\"1787691028850118657\",\"updateDate\":\"2025-01-06T11:27:30.4360927\"},\"regularInteractionConfig\":null,\"aiChatConfig\":{\"id\":null,\"liveId\":null,\"platform\":null,\"enable\":0,\"replyWay\":0,\"keywords\":null,\"state\":null,\"creator\":null,\"createDate\":\"0001-01-01T00:00:00\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"interestNumberConfig\":{\"id\":\"c10a2605-814f-4f14-a7d5-4ab611c5f39b\",\"liveId\":\"e78fc1a2-8a5b-4104-b478-5229bce3071b\",\"platform\":\"抖音\",\"enable\":0,\"replyWay\":2,\"interestNumberParameters\":null,\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2025-01-05T21:03:20.0093211\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"likeConfig\":{\"id\":\"6351e524-f00e-4d6a-81ba-8f92910eb4c0\",\"liveId\":\"e78fc1a2-8a5b-4104-b478-5229bce3071b\",\"platform\":\"抖音\",\"enable\":0,\"replyWay\":2,\"likeParameters\":null,\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2025-01-05T21:03:19.9794211\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"onLineNumberConfig\":{\"id\":\"48213485-022b-4ffe-b39e-359e5b9c743c\",\"liveId\":\"e78fc1a2-8a5b-4104-b478-5229bce3071b\",\"platform\":\"抖音\",\"enable\":0,\"replyWay\":2,\"onLineNumberParameters\":\"[{\\\"Url\\\":null,\\\"TempContent\\\":null,\\\"contentType\\\":0,\\\"content\\\":\\\"12322\\\",\\\"number\\\":10}]\",\"state\":null,\"creator\":\"1787691028850118657\",\"createDate\":\"2025-01-05T21:03:19.9993552\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"},\"blacklistConfig\":{\"id\":null,\"liveId\":\"909682638981\",\"platform\":\"抖音\",\"blacklist\":null,\"state\":null,\"creator\":null,\"createDate\":\"0001-01-01T00:00:00\",\"updater\":null,\"updateDate\":\"0001-01-01T00:00:00\"}}"
        }
    )

    console.log("sendConfig=----")
    webSocket.value.send(messageData)
}


onMounted(() => {
    // socketInit()
})

onUnmounted(() => {
    console.log("组件销毁1111")
    // 销毁socket
    closeSocket()
})
</script>

<style lang="scss" scoped></style>